package com.jiyang.jyandroid.test06;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import com.jiyang.jyandroid.BaseActivity;

/**
 * Created by jy on 2016/11/25.
 * service
 */

public class Six_1Activity extends BaseActivity {
    public static final String MY_BROADCAST = "my_broadcast";

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Button button = new Button(this);
        button.setText("发送广播开启服务");
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(MY_BROADCAST);
                intent.putExtra("msg", "Hello 广播");
                sendBroadcast(intent);
            }
        });
        addContentView(button, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    }
}
